package com.wan.adapter

import android.content.Context
import android.widget.ImageView
import com.wan.R
import com.wan.uitls.ItemRightViewListener

class ShowRvAdapter(context: Context, data: ArrayList<String>, itemViewId: Int) : BaseRecyclerAdapter<String>(context, data, itemViewId) {

    private var listener: ItemRightViewListener? = null

    fun setDeleteListener(listener: ItemRightViewListener) {
        this.listener = listener
    }

    override fun convert(holder: BaseViewHolder, itemEntity: String, position: Int) {
        holder.setText(R.id.show_rv_item_tv, itemEntity)
        var imageView = holder.getView<ImageView>(R.id.show_rv_delete_iv)
        imageView.setOnClickListener {
            if (listener != null) {
                listener!!.onRightViewClickListener(position)
            }
        }
    }
}